#include<cstdio>
#include<string.h>
#include<string>
#include<iostream>
#include<fstream>
#include<vector>
#include<cstdlib>
#include<set>
#include<map>
#include<stack>
#include<utility>
#include<climits>
using namespace std;

typedef struct node{
	int nodeID;
	struct node *next;
} element;

class LinkedList{
public:
	element *L;
	LinkedList(){
		L=NULL;
	}
	~LinkedList(){
		L=NULL;
	}



	void inline insert(const int x){
		element *temp = (element*)malloc(sizeof(element));
		temp->nodeID=x;
		temp->next=L;
		L=temp;
	}
	int inline find(const int x){
		int count=0; int index=-1;
		element *temp=L;
		while(temp!=NULL){
			if(temp->nodeID==x) {index=count; break;}
			temp=temp->next;
			count++;
		}
		return index;
	}

	int inline remove(const int x){
		int count=0; int index=-1;
		element *temp=L; element*prev;
		if(L==NULL) return -1;
		else{
			while(temp!=NULL){
				if(temp->nodeID==x) {index=count; break;}
				prev=temp;
				temp=temp->next;
				count++;
			}
			if(index ==-1) return -1;
			else{
				if(index==0) {
					temp=L; L=L->next;
					free(temp); temp=NULL;
				}
				else{
					prev->next = temp->next;
					free(temp); temp=NULL;
				}
				return 0;
			}

		}
	}
	void show(){
		element *temp = L;
		while(temp!=NULL){
			cout<<temp->nodeID<<" ";
			temp=temp->next;
		}



	}
	vector<int> inline getElements(){
		vector<int>A = vector<int>();
		element *temp = L;
		//cout<<temp<<endl;
		while(temp!=NULL) {A.push_back(temp->nodeID); temp=temp->next;}
		return A;
	}

	int inline getNumberOfElements(){
		element *temp = L; int count=0;
		while(temp!=NULL)	{
			temp=temp->next; count++;
		}
		return count;
	}
};
